package com.stn.zjx.givingtreasure.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class TitleTabFragmentAdapter extends FragmentPagerAdapter {
    public Context context;
    public List<Fragment> fragments;
    public String[] titles;
    public TitleTabFragmentAdapter(Context context, FragmentManager fm, List<Fragment> fragments, String[] titles) {
        super(fm);
        this.context=context;
        this.fragments=fragments;
        this.titles=titles;
    }
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
